<%@ page language="java"  session="false" %>
<%
// final String url = "http://localhost/portal_web/";
// final String url = "http://10.2.176.37:8080/portal_web/";
//String path = request.getContextPath();
//String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/portal_web";
//response.sendRedirect(response.encodeURL(basePath));

String turnURL = "";
String path = request.getContextPath();
String requestPath = request.getHeader("referer");
if(requestPath != null && requestPath.indexOf("/rest/") > 0){
	requestPath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+"/portal_web";
}


final String casTest = request.getParameter("casTest");
final String callBackURL = request.getParameter("currentURL");

if(casTest != null && "ON".equalsIgnoreCase(casTest) && callBackURL != null && !"".equals(callBackURL)){
 	turnURL = callBackURL;
}else{
	turnURL = requestPath;
}

// out.print("turnURL="+turnURL);
request.getSession().invalidate();
response.sendRedirect(response.encodeURL(turnURL));
%>
